package rr_server;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.SWT;

public class MainWindow {
	
	Display display;
	MainWindow window;
	Server server;
	StyledText styledText;

	public static void main(String[] args) {
		try {
			MainWindow window = new MainWindow();
			window.window = window;
			window.server = new Server(window);
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void open() {
		display = Display.getDefault();
		Shell shlRhythmRouletteServer = new Shell();
		shlRhythmRouletteServer.setImage(SWTResourceManager.getImage(
				MainWindow.class, "/rr_server/RR_Logo_1.png"));
		shlRhythmRouletteServer.setSize(950, 500);
		shlRhythmRouletteServer.setText("Rhythm Roulette Server");

		styledText = new StyledText(shlRhythmRouletteServer,
				SWT.BORDER);
		styledText.setSelectionForeground(SWTResourceManager.getColor(255, 255,
				255));
		styledText.setSelectionBackground(SWTResourceManager.getColor(51, 51,
				51));
		styledText.setForeground(SWTResourceManager.getColor(144, 238, 144));
		styledText.setBackground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		styledText.setMarginColor(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		styledText.setBottomMargin(10);
		styledText.setLeftMargin(10);
		styledText.setRightMargin(10);
		styledText.setTopMargin(10);
		styledText.setFont(SWTResourceManager
				.getFont("Fixedsys", 9, SWT.NORMAL));
		styledText.setBounds(0, 0, 932, 455);
		styledText.setWordWrap(true);

		shlRhythmRouletteServer.open();
		shlRhythmRouletteServer.layout();
		
		while (!shlRhythmRouletteServer.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}
	
}